var { pool } = require('../utils/dbUtil')

// 查找admin
function selectAdmin(userName) {
    let sql = 'select * from manger where mangerName = ?';
    return new Promise((resolve, reject) => {
        pool.getConnection(function (connError, connection) {
            if (connError) {
                reject(connError)
            } else {
                connection.query(sql, [userName], (queryError, rows) => {
                    if (queryError) {
                        connection.release()
                        reject(14, queryError)
                    } else {
                        connection.release()
                        resolve(rows)
                    }
                })
            }
        })
    })
}

module.exports = {
    selectAdmin
}